eval(read('/apps/notex.jsx'));
notex.usage('The task administration service',
            {username: 'The "admin/tasks" service username',
             password: 'The "admin/tasks" service password',
             action: 'The action to perform',
             task: 'JSON format of a task to update or add'});
notex.service.auth('admin/tasks');

// Setup database options
var options; eval('options=' + read('../options.jsx'));

// Handle task inserts, updates, deletes and selects
var action = param('action') || 'select';
if (action == 'delete') notex.error("Sorry can't delete tasks");
var task = param('task'); if (task) eval('task=' + task);
var result = notex.service.orm.action(action, 'tasks', task, options);
write(result.toXMLString());

// END
